$(function () {
    $('#money').val(getItem('phone'))
    doAjax();
})

function doAjax() {
    $.ajax({
        url:'/flux/fluxAll.json',
        dataType:'json',
        data:{
            companyCode:getItem('companyCode'),
        },
        success:function (data) {
            if(data.code==1){
                var flowLength = data.datas;
                for(var i=0;i<flowLength.length;i++){
                    $('<div class="flow_item" money="'+flowLength[i].money+'" flux="'+flowLength[i].flux+'" fluxId="'+flowLength[i].id+'">\n' +
                        '                <span>'+flowLength[i].flux+'M</span><span>'+flowLength[i].money+'元</span>\n' +
                        '            </div>').appendTo($('.flow_box'))
                }
                mui('body').on('tap','.flow_item',function () {
                    $(this).css({'background':'#0589e8','color':'#fff'})
                    var money = $(this).attr('money');
                    var flux = $(this).attr('flux');
                    var fluxId = $(this).attr('fluxId');
                    var phone = $('#money').val();
                    window.location.href="flow_choosePayWay.html?payMoney="+money+'&flux='+flux+'&fluxId='+fluxId+'&phone='+phone;
                })
            }
        }
    })
}

document.getElementById('record').addEventListener('tap',function () {
    window.location.href="flow_order.html";
})